package com.ddone.config;

import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.TopicBuilder;

/**
 * @author ddone
 * @date 2024/5/13-23:19
 */
@Configuration
public class KafkaInitConfig {

    @Bean
    public NewTopic springTestTopic() {
        return TopicBuilder.name("spring-test-topic")
                .partitions(3)
                .replicas(3)
                .build();
    }

    @Bean
    public NewTopic springTestRetryTopic(){
        return TopicBuilder.name("spring-test-retry-topic")
                // 主题名称
                .partitions(1)
                // 分区数量
                .replicas(1)
                // 副本数量
                .build();
    }

}
